package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GlDetailMapper;
import com.ruoyi.system.domain.GlDetail;
import com.ruoyi.system.service.IGlDetailService;
import com.ruoyi.common.core.text.Convert;

/**
 * 凭证分录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-15
 */
@Service
public class GlDetailServiceImpl implements IGlDetailService 
{
    @Autowired
    private GlDetailMapper glDetailMapper;

    /**
     * 查询凭证分录
     * 
     * @param pkDetail 凭证分录主键
     * @return 凭证分录
     */
    @DataSource(DataSourceType.SLAVE)
    @Override
    public GlDetail selectGlDetailByPkDetail(String pkDetail)
    {
        return glDetailMapper.selectGlDetailByPkDetail(pkDetail);
    }

    /**
     * 查询凭证分录列表
     * 
     * @param glDetail 凭证分录
     * @return 凭证分录
     */
    @Override
    public List<GlDetail> selectGlDetailList(GlDetail glDetail)
    {
        return glDetailMapper.selectGlDetailList(glDetail);
    }

    /**
     * 新增凭证分录
     * 
     * @param glDetail 凭证分录
     * @return 结果
     */
    @Override
    public int insertGlDetail(GlDetail glDetail)
    {
        return glDetailMapper.insertGlDetail(glDetail);
    }

    /**
     * 修改凭证分录
     * 
     * @param glDetail 凭证分录
     * @return 结果
     */
    @Override
    public int updateGlDetail(GlDetail glDetail)
    {
        return glDetailMapper.updateGlDetail(glDetail);
    }

    /**
     * 批量删除凭证分录
     * 
     * @param pkDetails 需要删除的凭证分录主键
     * @return 结果
     */
    @Override
    public int deleteGlDetailByPkDetails(String pkDetails)
    {
        return glDetailMapper.deleteGlDetailByPkDetails(Convert.toStrArray(pkDetails));
    }

    /**
     * 删除凭证分录信息
     * 
     * @param pkDetail 凭证分录主键
     * @return 结果
     */
    @Override
    public int deleteGlDetailByPkDetail(String pkDetail)
    {
        return glDetailMapper.deleteGlDetailByPkDetail(pkDetail);
    }
}
